home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November A / PCWK1103A.iso / Adobe After Effects 6.0 tryout / MM11.Cab / F96067_help.js.4724F819_1843_41AB_AA70_80E2C0E775CD < prev    next >
Text File  |  2003-07-18  |  31KB  |  968 lines

  1. <!--[CDATA[
  2.  
  3. var upperAsciiXlatTbl = new Array(
  4. 223,"ss",
  5. 230,"ae",
  6. 198,"ae",
  7. 156,"oe",
  8. 140,"oe",
  9. 240,"eth",
  10. 208,"eth",
  11. 141,"y",
  12. 159,"y"
  13. );
  14.  
  15. var maxNumberOfShownSearchHits = 100;
  16. var showInputStringAlerts = 0;
  17. var navigationCookie = "";
  18.  
  19. /////////////////////////////// COOKIE-RELATED FUNCTIONS ////////////////////////
  20. // Bill Dortch getCookieVal and GetCookie routines
  21. function getCookieVal(offset) {
  22.   var endstr=document.cookie.indexOf(";",offset);
  23.   if (endstr==-1)endstr=document.cookie.length;
  24.   return unescape(document.cookie.substring(offset, endstr));
  25. }
  26. function GetCookie(name) {
  27.   var arg=name+"=";
  28.   var alen=arg.length;
  29.   var clen=document.cookie.length;
  30.   var i=0;
  31.   while(i<clen){
  32.     var j=i+alen;
  33.     if(document.cookie.substring(i,j)==arg)return getCookieVal(j);
  34.     i=document.cookie.indexOf(" ",i)+1;
  35.     if(i==0)break; 
  36.   }
  37.   return null;
  38. }
  39. function getTopCookieVal(offset) {
  40.   var endstr=top.document.cookie.indexOf(";",offset);
  41.   if (endstr==-1)endstr=top.document.cookie.length;
  42.   return unescape(top.document.cookie.substring(offset, endstr));
  43. }
  44. function GetTopCookie(name) {
  45.   var arg=name+"=";
  46.   var alen=arg.length;
  47.   var clen=top.document.cookie.length;
  48.   var i=0;
  49.   while(i<clen){
  50.     var j=i+alen;
  51.     if(top.document.cookie.substring(i,j)==arg)return getTopCookieVal(j);
  52.     i=top.document.cookie.indexOf(" ",i)+1;
  53.     if(i==0)break; 
  54.   }
  55.   return null;
  56. }
  57. // SetCookie
  58. // -----------
  59. // This function is called to set a cookie in the current document.
  60. //  params:
  61. //        n - name of the cookie
  62. //        v - value of the cookie
  63. //        minutes - the duration of the cookie in minutes (that is, how many minutes before it expires)
  64. function SetCookie(n,v,minutes) {
  65.  var Then = new Date();
  66.  Then.setTime(Then.getTime() + minutes * 60 * 1000);
  67.  document.cookie = n + "=" + v + ";expires=" + Then.toGMTString();
  68. }
  69. // getContentCookie
  70. // ----------------
  71. // This function reads the content cookie set by the handleContext funtion.
  72. //
  73. function getContentCookie()
  74. {
  75.     var contentCookie = GetCookie("content");
  76.     top.document.cookie = "content=";
  77.  
  78.     // What does this expression mean?
  79.     // (contentCookie.indexOf("htm") != -1)
  80.     if ( (contentCookie != null) && (contentCookie.indexOf("htm") != -1) ) 
  81.     {
  82.         document.cookie = "content="; // Wipe out the cookie
  83.         top.document.cookie = "histR=" + contentCookie;
  84.         location.replace(contentCookie);
  85.     }            
  86. }
  87. // getNavigationCookie
  88. // -------------------
  89. // This function reads the content cookie set by the handleContext funtion.
  90. //
  91. function getNavigationCookie()
  92. {
  93.     navigationCookie = GetCookie("navigation");
  94.     top.document.cookie = "navigation=";
  95.  
  96.     // What does this expression mean?
  97.     // (navigationCookie.indexOf("htm") != -1)
  98.     if ( (navigationCookie != null) && (navigationCookie.indexOf("htm") != -1) ) 
  99.     {
  100.         document.cookie = "navigation="; // Wipe out the cookie
  101.         top.document.cookie = "histL=" + navigationCookie;
  102.         location.replace(navigationCookie);
  103.     }
  104.                 
  105. }
  106.  
  107. // handleContext
  108. // -------------
  109. // This function is called from content pages. It sets a cookie as soon
  110. // as the page is loaded. If the content page is not in it's proper place
  111. // in the frameset, the frameset will be loaded and the page will be 
  112. // restored using the value in this cookie.
  113. //
  114. function handleContext(which)
  115. {
  116.     var docLocLastNode = lastNodeOf(document.location);
  117.  
  118.     if( top.frames.length ) {
  119.         
  120.         if( which ) {    // This page is supposed to go into the CONTENT frame
  121.             if( docLocLastNode != lastNodeOf(top.frames[1].location) ) {    // ...but it is being loaded elsewhere
  122.                 top.location.replace("help.html");
  123.                 top.document.cookie = "content=" + docLocLastNode;
  124.             }
  125.             else {
  126.                 top.document.cookie = "histR=" + docLocLastNode;
  127.             }
  128.         }
  129.         else {            // This page is supposed to go into the NAVIGATION frame
  130.             if( docLocLastNode != lastNodeOf(top.frames[0].location) ) {    // ...but it is being loaded elsewhere
  131.                 top.location.replace("help.html");
  132.                 top.document.cookie = "navigation=" + lastNodeOf(top.frames[1].history.previous);
  133.             }
  134.             else {
  135.                 top.document.cookie = "histL=" + docLocLastNode;
  136.             }
  137.         }
  138.     }
  139.     else {
  140.         if( which ) {
  141.             top.document.cookie = "navigation=1_0_0_0.html";
  142.             top.document.cookie = "histL=1_0_0_0.html";
  143.             top.document.cookie = "content=" + docLocLastNode;
  144.             top.document.cookie = "histR=" + docLocLastNode;
  145.         }
  146.         else {
  147.             top.document.cookie = "navigation=" + docLocLastNode;
  148.             top.document.cookie = "histL=" + docLocLastNode;
  149.             top.document.cookie = "content=splash.html";
  150.             top.document.cookie = "histR=splash.html";
  151.         }
  152.         top.location.replace("help.html");
  153.     }
  154. }
  155. // lastNodeOf
  156. // ----------
  157. // This function gets passed a URL and returns the last node of same.
  158. function lastNodeOf(e)
  159. {
  160.     var expr = "" + e;
  161.     var pos = expr.lastIndexOf("/");
  162.  
  163.     if( (pos != -1) && (pos+1 != expr.length) ) {
  164.         return expr.substr(pos+1);
  165.     }
  166.     else {
  167.         return expr;
  168.     }
  169. }
  170. // frameBuster
  171. // -----------
  172. // This function is called by the frameset to ensure it's always loaded
  173. // at the top level of the current window.
  174. //
  175. function frameBuster()
  176. {
  177.     var thisLocation = document.location;
  178.     if ( document.location != top.location )
  179.     {
  180.         top.location.replace("help.html");
  181.     }
  182. }
  183.  
  184.  
  185. // SEARCH RELATED.......................................SEARCH RELATED
  186. // SEARCH RELATED.......................................SEARCH RELATED
  187. // SEARCH RELATED.......................................SEARCH RELATED
  188. // SEARCH RELATED.......................................SEARCH RELATED
  189. // SEARCH RELATED.......................................SEARCH RELATED
  190. // SEARCH RELATED.......................................SEARCH RELATED
  191. // SEARCH RELATED.......................................SEARCH RELATED
  192. // SEARCH RELATED.......................................SEARCH RELATED
  193. // SEARCH RELATED.......................................SEARCH RELATED
  194. // SEARCH RELATED.......................................SEARCH RELATED
  195. function bubbleSortWithShadow(a,b)
  196. {
  197.     var temp;
  198.     for(var j=1; j<a.length; j++) {
  199.         for(var i=0; i<j; i++) {
  200.             if( a[i] < a[j] ) {    
  201.                 temp = a[j];a[j] = a[i];a[i] = temp;
  202.                 temp = b[j];b[j] = b[i];b[i] = temp;
  203.             }
  204.         }
  205.     }
  206. }
  207. //---------------------------------------------------
  208. function buildHtmlResultsStr()
  209. {
  210.     var innerHTMLstring,ndxEnd;
  211.  
  212.     // Gather all of the results display lines into the 'resultsArr'
  213.         ndxEnd = (matchesArrIndices.length > maxNumberOfShownSearchHits ) ? maxNumberOfShownSearchHits : matchesArrIndices.length;
  214.  
  215.         for(var ndx=0, resultsArr = new Array(); ndx < ndxEnd; ndx++) {
  216.             resultsArr[resultsArr.length] = buildResultsStrOneLine(matchesArrIndices[ndx],matchesArrHits[ndx]);
  217.         }
  218.  
  219.     // Convert this 'resultsArr' into a single string that will be injected into this search page.
  220.         innerHTMLstring = "<p>\n";
  221.         for( var ndx=0; ndx < resultsArr.length; ndx++ ) {
  222.             innerHTMLstring = innerHTMLstring + resultsArr[ndx] + "<br />\n";
  223.         }
  224.     return innerHTMLstring;
  225. }
  226. //---------------------------------------------------
  227. function buildResultsStrOneLine(a,b)
  228. {
  229.     var retStr;
  230.     retStr = "<a href=\"" + top.fileArr[a] + ".html\"";
  231.  
  232.     // for debug...
  233.     //retStr += "target=\"content\" ";
  234.     //retStr += "title=\"" + top.fileArr[a] + ".html-";
  235.     //retStr += a + "-" + b + "\">";
  236.  
  237.     // for production...
  238.     retStr += "target=\"content\" >";
  239.  
  240.     retStr += top.titleArr[a] + "</a>";
  241.     return retStr;
  242. }
  243. //---------------------------------------------------
  244. // checkForHits
  245. //  Break up the search term into words.
  246. //  Check each of those words against...
  247. //        (a) cached titles and 
  248. //        (b) cached content lines 
  249. //  Perform the hit detection for each one, 
  250. //  storing the results into (hits-ordered) 
  251. //        'matchesArrIndices' and 
  252. //        'matchesArrHits'.
  253. //---------------------------------------------------
  254. function checkForHits()
  255. {
  256.     var inputWords = new Array();
  257.     var tempArr = new Array();
  258.  
  259.     // Split the search term into individual search words
  260.         tempArr = searchTerm.split(" ");
  261.         for(var ndx=0; ndx < tempArr.length; ndx++) {
  262.             if( tempArr[ndx].length ) {
  263.                 inputWords[inputWords.length] = tempArr[ndx];
  264.             }
  265.         }
  266.  
  267.     // Initialization
  268.         matchesArrHits = new Array();
  269.         matchesArrIndices = new Array();
  270.  
  271.     // Initialize the 'maskArr' and the 'hitsArr'
  272.         maskArr = new Array();
  273.         hitsArr = new Array();
  274.         for( var ndx = 0; ndx < top.fileArr.length; ndx++ ) {maskArr
  275.             maskArr[maskArr.length] = 1;
  276.             hitsArr[hitsArr.length] = 0;
  277.         }
  278.  
  279.     // Do checking for matches on EACH OF THE INPUT WORDS
  280.         for( var ndx = 0; ndx < inputWords.length; ndx++ ) {
  281.  
  282.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  283.             if( ! checkForHitsWordAgainstPages( inputWords[ndx] ) ) {
  284.                 return;     // No sense in continuing, match has failed.
  285.             }
  286.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  287.  
  288.             for( var ndx2 = 0; ndx2 < hitsArr.length; ndx2++ ) {
  289.                 if( hitsArr[ndx2] == 0 ) {
  290.                     maskArr[ndx2] = 0;
  291.                 }
  292.                 else {
  293.                     if( maskArr[ndx2] != 0 ) {
  294.                         maskArr[ndx2] += hitsArr[ndx2];
  295.                     }
  296.                 }
  297.             }
  298.         }
  299.  
  300.     // From the final 'maskArr', generate 'matchesArrHits' and 'matchesArrIndices'    
  301.         for( var ndx = 0; ndx < maskArr.length; ndx++ ) {
  302.             if( maskArr[ndx] ) {
  303.                 matchesArrHits[matchesArrHits.length] = maskArr[ndx];
  304.                 matchesArrIndices[matchesArrIndices.length] = ndx;
  305.             }
  306.         }
  307.  
  308.     // If there were any hits, then sort them by highest hits first
  309.         if( matchesArrIndices.length ) {
  310.             bubbleSortWithShadow(matchesArrHits, matchesArrIndices);
  311.         }
  312. }
  313. //---------------------------------------------------
  314. function checkForHitsWordAgainstPages(w)        
  315. {
  316.     var hitAnywhere = 0;
  317.  
  318.     // Process each of the content lines (one per file/page)
  319.         for(var ndx=0; ndx < top.sc2.length; ndx++) {
  320.  
  321.             // Put the cached title into glob_title
  322.                 glob_title = top.sc1[ndx];
  323.  
  324.             // Put the cached content line into glob_phrase
  325.                 glob_phrase = top.sc2[ndx];
  326.                 
  327.             if( maskArr[ndx] ) {
  328.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  329.                 if( top.isDblByte ) {
  330.                     hitsArr[ndx] = checkForHitsWordAgainstTitleAndLine2(w,ndx);
  331.                 }
  332.                 else {
  333.                     hitsArr[ndx] = checkForHitsWordAgainstTitleAndLine(w,ndx);
  334.                 }
  335.                 if( hitsArr[ndx] ) {
  336.                     hitAnywhere = 1;
  337.                 }
  338.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  339.             }
  340.         }
  341.     return hitAnywhere;
  342. }
  343. //---------------------------------------------------
  344. function checkForHitsWordAgainstTitleAndLine(w, lineNdx)
  345. {
  346.     var words;
  347.     var titleHitCnt = 0;
  348.     var contentHitCnt = 0;
  349.     var regex = new RegExp(w, "i");
  350.  
  351.     // TITLE .........................................
  352.         words = new Array();
  353.         words = glob_title.split(" ");
  354.  
  355.         // EXECUTE TITLE MATCH TEST
  356.         for( var ndx = 0; ndx < words.length; ndx++ ) {
  357.             if( w == words[ndx] ) {
  358.                 titleHitCnt += 100;
  359.                 break;
  360.             }
  361.         }
  362.  
  363.     // CONTENT .........................................
  364.         words = new Array();
  365.         words = glob_phrase.split(" ");
  366.  
  367.         // EXECUTE CONTENT MATCH TEST
  368.         if( regex.test(glob_phrase) ) {    // See if word is anywhere within the phrase first.
  369.             for( var ndx = 0; ndx < words.length; ndx++ ) {
  370.                 if( w == words[ndx] ) {
  371.                     contentHitCnt += getInstanceCount(lineNdx,ndx);
  372.                     break;
  373.                 }
  374.                 else if( w < words[ndx] ) { // If word is greater than the remaining words, leave
  375.                     break;
  376.                 }
  377.             }
  378.         }
  379.  
  380.     return titleHitCnt + contentHitCnt;
  381. }
  382. //---------------------------------------------------
  383. function checkForHitsWordAgainstTitleAndLine2(w, lineNdx)
  384. {
  385.     var titleHitCnt = 0;
  386.     var contentHitCnt = 0;
  387.  
  388.     // TITLE .........................................
  389.         if( glob_title.indexOf(w) != -1 ) {
  390.             titleHitCnt = 100;
  391.         }
  392.  
  393.     // CONTENT .........................................
  394.         contentHitCnt = indexesOf(glob_phrase,w);
  395.  
  396.     return titleHitCnt + contentHitCnt;
  397. }
  398. //---------------------------------------------------
  399. // checkTheInputString
  400. // 
  401. //  returns...
  402. //        empty string - if there is valid input to search
  403. //        message string - if there is NO VALID INPUT to search
  404. //---------------------------------------------------
  405. function checkTheInputString()
  406. {
  407.     var myArr = new Array();
  408.     var tempArr = new Array();
  409.     var foundStopOrShortWord = 0;
  410.     var ptn1 = /\d\D/;
  411.     var ptn2 = /\D\d/;
  412.  
  413.     handleWhitespaceRemoval();
  414.  
  415.     searchTerm = searchTerm.toLowerCase();
  416.  
  417.     searchTerm = filterTheChars(searchTerm);
  418.         
  419.     handleWhitespaceRemoval();
  420.  
  421.     if( searchTerm.length ) {
  422.         
  423.         // Split the searchTerm
  424.             tempArr = searchTerm.split(" ",100);
  425.             if(showInputStringAlerts){alert( "size of tempArr: " + tempArr.length );}
  426.  
  427.         // Handle periods
  428.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  429.                 if( tempArr[ndx].charCodeAt(0) == 46 ) {    // periods at the start of word
  430.                     //tempArr[ndx] = tempArr[ndx].substr(1); // NOTE: We don't want to do this. (e.g. ".txt")
  431.                 }
  432.                 if( tempArr[ndx].charCodeAt(tempArr[ndx].length-1) == 46 ) { // end of word
  433.                     tempArr[ndx] = tempArr[ndx].substr(0,tempArr[ndx].length-1);
  434.                 }
  435.             }
  436.             
  437.         // Do stopwords and shortwords removal
  438.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  439.                 var word = tempArr[ndx];
  440.                 if(showInputStringAlerts){alert( "Checking word: " + word );}
  441.                 
  442.                 if( ! top.sw[word] ) {
  443.                     if( word.length < 2 ) {
  444.                         foundStopOrShortWord = 1;
  445.                     }
  446.                     else if( (word.length > 2) || (ptn1.test(word) || ptn2.test(word)) ) {
  447.                         myArr[myArr.length] = tempArr[ndx];
  448.                     }
  449.                     else {
  450.                         foundStopOrShortWord = 1;
  451.                     }
  452.                 }
  453.                 else {
  454.                     foundStopOrShortWord = 1;
  455.                 }
  456.             }
  457.  
  458.         // Now reconstruct the searchTerm, based upon the 'myArr'
  459.             searchTerm = "";
  460.             for( var ndx = 0; ndx < myArr.length; ndx++ ) {
  461.                 searchTerm = searchTerm + myArr[ndx] + " ";
  462.             }
  463.  
  464.         handleWhitespaceRemoval();
  465.  
  466.         if(showInputStringAlerts){alert( "FINAL SEARCH TERM: *" + searchTerm + "*" );}
  467.             
  468.         if( foundStopOrShortWord && ! searchTerm.length ) {
  469.             return MSG_stopAndShortWords;
  470.         }
  471.         top.srch_input_massaged = searchTerm;
  472.         return "";
  473.     } 
  474.     else {
  475.         return MSG_noSearchTermEntered;
  476.     }
  477. }
  478. //---------------------------------------------------
  479. function checkTheInputString2()        // double-byte version
  480. {
  481.     var tempArr = new Array();
  482.  
  483.     handleWhitespaceRemoval();
  484.  
  485.     if( searchTerm.length ) {
  486.  
  487.         // Split the searchTerm
  488.             tempArr = searchTerm.split(" ",100);
  489.             if(showInputStringAlerts){alert( "number of search terms: " + tempArr.length );}
  490.  
  491.         // Now reconstruct the searchTerm, based upon the 'tempArr'
  492.             searchTerm = "";
  493.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  494.                 searchTerm = searchTerm + tempArr[ndx] + " ";
  495.             }
  496.             handleWhitespaceRemoval();
  497.  
  498. if(showInputStringAlerts){alert( "Massaged search term: " + searchTerm );}
  499.  
  500.         top.srch_input_massaged = searchTerm;
  501.         return "";
  502.     }
  503.     else {
  504.         return MSG_noSearchTermEntered;
  505.     }
  506. }
  507. //---------------------------------------------------
  508. function dispatch() {
  509.     if ( top.frames.length && is_ie && (top.srch_1_shot || top.srch_message.length) ){
  510.         doIEsearch();
  511.     }
  512. }
  513. //---------------------------------------------------
  514. function doIEsearch()
  515. {
  516.     var stStr = "";
  517.     
  518.     document.forms["search"].input.value = top.srch_input_verbatim;
  519.     
  520.     if( top.srch_message.length ) {
  521.         document.all.results.innerHTML = top.srch_message;
  522.         top.srch_message = "";
  523.     }
  524.     else if( top.srch_1_shot ) {
  525.         top.srch_1_shot = 0;
  526.         
  527.         searchTerm = top.srch_input_massaged;
  528.         checkForHits();    // Sets: 'matchesArrIndices' and 'matchesArrHits'
  529.  
  530.         if( matchesArrIndices.length ) {    // If there were matches/hits...
  531.             stStr = MSG_pagesContaining + top.srch_input_massaged + "<br /><br />\n";
  532.             document.all.results.innerHTML = stStr + buildHtmlResultsStr();
  533.         }
  534.         else {
  535.             document.all.results.innerHTML = MSG_noPagesContain + top.srch_input_massaged;
  536.         }
  537.         searching_message.style.visibility="hidden";
  538.     }
  539.     top.srch_input_verbatim = "";
  540. }
  541. //---------------------------------------------------
  542. function doNNsearch()
  543. {
  544.     if( !top.frames.length || !(is_nav4up || is_gecko || is_opera) ) {return;}
  545.     
  546.     var ndxEnd;
  547.  
  548.     document.forms["search"].input.value = top.srch_input_verbatim; //"";
  549.     
  550.     if( top.srch_message.length ) {
  551.         document.write(top.srch_message);
  552.         top.srch_message = "";
  553.     }
  554.     else if( top.srch_1_shot ) {
  555.         top.srch_1_shot = 0;
  556.                 
  557.         searchTerm = top.srch_input_massaged;
  558.  
  559.         checkForHits();
  560.  
  561.         if( matchesArrIndices.length ) {
  562.  
  563.             document.write(MSG_pagesContaining + top.srch_input_massaged + "<br /><br />\n");
  564.  
  565.             ndxEnd = (matchesArrIndices.length > maxNumberOfShownSearchHits ) ? maxNumberOfShownSearchHits : matchesArrIndices.length;
  566.  
  567.             for(var ndx=0; ndx < ndxEnd; ndx++) {
  568.                 document.write(buildResultsStrOneLine(matchesArrIndices[ndx],matchesArrHits[ndx]) + "<br />\n");
  569.             }    
  570.         }
  571.         else {
  572.             document.write(MSG_noPagesContain + top.srch_input_massaged);
  573.         }
  574.         if (is_nav4) {
  575.             document.layers["searching_message"].visibility="hidden";
  576.         }
  577.     }
  578.     top.srch_input_verbatim = "";
  579.     if (is_nav4) {
  580.         window.stop();
  581.     }
  582. }
  583. //---------------------------------------------------
  584. function getInstanceCount( lineIndex, wordIndex )
  585. {
  586.     var instancesStr = top.instances[lineIndex];    // e.g. "1432931"
  587.     var ch = instancesStr.substr(wordIndex,1);
  588.     
  589.     return parseInt(ch);
  590. }
  591. //---------------------------------------------------
  592. function handleWhitespaceRemoval()
  593. {
  594.     var re_1 = /^\s/;
  595.     var re_2 = /\s$/;
  596.     var re_3 = /\s\s/;
  597.     var temp;
  598.  
  599.     // Remove leading whitespace
  600.         while( true ) {
  601.             temp = searchTerm.replace(re_1,"");
  602.             if( temp == searchTerm ) {
  603.                 break;
  604.             }
  605.             searchTerm = temp;
  606.         }
  607.     // Remove trailing whitespace
  608.         while( true ) {
  609.             temp = searchTerm.replace(re_2,"");
  610.             if( temp == searchTerm ) {
  611.                 break;
  612.             }
  613.             searchTerm = temp;
  614.         }
  615.     // Replace multiple contiguous spaces with a single space
  616.         while( searchTerm.search(re_3) != -1 ) {
  617.             temp = searchTerm.replace(re_3," ");
  618.             searchTerm = temp;
  619.         }
  620. }
  621. //--------------------------------------------------
  622. function isAcceptableChar(chrNdx)
  623. {
  624.     var acceptableChars = new Array( 32, 46, 95 );    // space, period, underscore
  625.     
  626.     for( var ndx = 0; ndx < acceptableChars.length; ndx++ ) {
  627.         if( chrNdx == acceptableChars[ndx] ) {
  628.             return true;
  629.         }
  630.     }
  631.     return false;
  632. }
  633. //--------------------------------------------------
  634. function indexesOf(str,ptn)
  635. {
  636.     var position = 0;
  637.     var hits = -1;
  638.     var start = -1;
  639.  
  640.     while( position != -1 ) {
  641.         position = str.indexOf(ptn, start+1);
  642.         hits += 1;
  643.         start = position;
  644.     }
  645.     return hits;
  646. }
  647. //--------------------------------------------------
  648. function filterTheChars(line)
  649. {
  650.     var retStr = "",tempStr;
  651.     var ch, chCode, retChr;
  652.     var ndx;
  653.     
  654.     for( ndx = 0; ndx < line.length; ndx++ ) {
  655.         ch = line.substr(ndx,1);
  656.         chCode = ch.charCodeAt(0);
  657.         
  658.         
  659.             if( (chCode >= 192) && (chCode <= 221) ) {    // Handle capital upper-ASCII characters
  660.                 chCode = chCode + 32;
  661.                 retChr = ASCII_to_char(chCode);
  662.             }
  663.             else if( withinAcceptableRanges(chCode) || isAcceptableChar(chCode) ) { // Acceptable characters
  664.                 retChr = ch;
  665.             }
  666.             else {
  667.                 tempStr = isLigatureChar(chCode);
  668.  
  669.                 if( tempStr.length ) {    // Handle ligature-style replacements
  670.                     retChr = tempStr;
  671.                 }
  672.                 else {        // Turn all else into space    
  673.                     retChr = " ";
  674.                 }
  675.             }
  676.  
  677.         // Grow the return string
  678.             retStr += retChr;
  679.     }
  680.     
  681.     return retStr;
  682. }
  683. //--------------------------------------------------
  684. function isLigatureChar(codeToCheck) {
  685.     var xlatTblNdx, code, replStr = "";
  686.  
  687.     for( xlatTblNdx = 0; xlatTblNdx < upperAsciiXlatTbl.length; xlatTblNdx+=2 ) {
  688.  
  689.         code = upperAsciiXlatTbl[xlatTblNdx];
  690.         if( code == codeToCheck ) {
  691.             replStr = upperAsciiXlatTbl[xlatTblNdx+1];
  692.             break;
  693.         }
  694.     }
  695.     
  696.     return replStr;
  697. }
  698. //--------------------------------------------------
  699. function respondToSearchButton() 
  700. {
  701.     var myStr;
  702.     
  703.     top.srch_input_verbatim = document.forms["search"].input.value;
  704.     searchTerm = document.forms["search"].input.value;
  705.     
  706.     if( top.isDblByte ) {
  707.         myStr = checkTheInputString2();
  708.     }
  709.     else {
  710.         myStr = checkTheInputString();    
  711.     }
  712.     
  713.     top.srch_message = myStr;
  714.     top.srch_1_shot = top.srch_message.length ? 0 : 1;
  715.     
  716.     if( (! myStr.length) && (! top.didDbLoad) ) {
  717.         document.location = "srch_fset.html";
  718.     }
  719.     else {
  720.         document.location = "search.html";
  721.     }
  722. }
  723. //---------------------------------------------------
  724. function strReplace(orig,src,dest)
  725. {
  726.     var startPos=0;
  727.     var matchPos = orig.indexOf(src,startPos);
  728.     var retLine="";
  729.     
  730.     while(matchPos != -1) {
  731.         retLine = retLine + orig.substring(startPos,matchPos) + dest;
  732.         startPos = matchPos+1;
  733.         matchPos = orig.indexOf(src,startPos);
  734.     }
  735.     if(! retLine.length) {return orig;}
  736.     else {return retLine+orig.substring(startPos,orig.length);}
  737. }
  738. //--------------------------------------------------
  739. function withinAcceptableRanges(chrNdx)
  740. {    
  741.     var acceptableRanges = new Array( "48-57","65-90","97-122","224-229","231-239","241-246","248-253","255-255");
  742.     
  743.     for( var ndx = 0; ndx < acceptableRanges.length; ndx++ ) {
  744.         var start_finish = new Array();
  745.  
  746.         start_finish = acceptableRanges[ndx].split("-");
  747.         
  748.         if( (chrNdx >= start_finish[0]) && (chrNdx <= start_finish[1]) ) {
  749.             return true;
  750.         }
  751.     }
  752.     return false;
  753. }
  754. //--------------------------------------------------
  755. function ASCII_to_char(num_in)
  756. {
  757.     var str_out = "";
  758.     var num_out = parseInt(num_in);
  759.     
  760.     num_out = unescape('%' + num_out.toString(16));
  761.     str_out += num_out;
  762.     
  763.     return unescape(str_out);
  764. }
  765.  
  766. // Ultimate client-side JavaScript client sniff. Version 3.02
  767. // (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
  768. // Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
  769. // Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
  770. //                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
  771. // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
  772. //                      correct Opera 5 detection
  773. //                      add support for winME and win2k
  774. //                      synch with browser-type-oo.js
  775. // Revised 26 Mar 01 to correct Opera detection
  776.  
  777. // Everything you always wanted to know about your JavaScript client
  778. // but were afraid to ask. Creates "is_" variables indicating:
  779. // (1) browser vendor:
  780. //     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
  781. // (2) browser version number:
  782. //     is_major (integer indicating major version number: 2, 3, 4 ...)
  783. //     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
  784. // (3) browser vendor AND major version number
  785. //     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
  786. //     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_hotjava3, is_hotjava3up,
  787. //     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
  788. // (4) JavaScript version number:
  789. //     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
  790. // (5) OS platform and version:
  791. //     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
  792. //     is_os2
  793. //     is_mac, is_mac68k, is_macppc
  794. //     is_unix
  795. //     is_sun, is_sun4, is_sun5, is_suni86
  796. //     is_irix, is_irix5, is_irix6
  797. //     is_hpux, is_hpux9, is_hpux10
  798. //     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
  799. //     is_linux, is_sco, is_unixware, is_mpras, is_reliant
  800. //     is_dec, is_sinix, is_freebsd, is_bsd
  801. //     is_vms
  802. //
  803. // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
  804. // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
  805. // for detailed lists of userAgent strings.
  806. //
  807. // Note: you don't want your Nav4 or IE4 code to "turn off" or
  808. // stop working when new versions of browsers are released, so
  809. // in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
  810. // is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
  811. // to check version in code which you want to work on future
  812. // versions.
  813.  
  814.     // convert all characters to lowercase to simplify testing
  815.     var agt=navigator.userAgent.toLowerCase();
  816.  
  817.     // *** BROWSER VERSION ***
  818.     // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
  819.     var is_major = parseInt(navigator.appVersion);
  820.     var is_minor = parseFloat(navigator.appVersion);
  821.  
  822.     // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
  823.     // If you want to allow spoofing, take out the tests for opera and webtv.
  824.     var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
  825.                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
  826.                 && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
  827.     var is_nav2 = (is_nav && (is_major == 2));
  828.     var is_nav3 = (is_nav && (is_major == 3));
  829.     var is_nav4 = (is_nav && (is_major == 4));
  830.     var is_nav4up = (is_nav && (is_major >= 4));
  831.     var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
  832.                           (agt.indexOf("; nav") != -1)) );
  833.     var is_nav6 = (is_nav && (is_major == 5));
  834.     var is_nav6up = (is_nav && (is_major >= 5));
  835.     var is_gecko = (agt.indexOf('gecko') != -1);
  836.  
  837.  
  838.     var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
  839.     var is_ie3    = (is_ie && (is_major < 4));
  840.     var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) );
  841.     var is_ie4up  = (is_ie && (is_major >= 4));
  842.     var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
  843.     var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
  844.     var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
  845.     var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
  846.  
  847.     // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
  848.     // or if this is the first browser window opened.  Thus the
  849.     // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
  850.     var is_aol   = (agt.indexOf("aol") != -1);
  851.     var is_aol3  = (is_aol && is_ie3);
  852.     var is_aol4  = (is_aol && is_ie4);
  853.     var is_aol5  = (agt.indexOf("aol 5") != -1);
  854.     var is_aol6  = (agt.indexOf("aol 6") != -1);
  855.  
  856.     var is_opera = (agt.indexOf("opera") != -1);
  857.     var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
  858.     var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
  859.     var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
  860.     var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
  861.     var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
  862.  
  863.     var is_webtv = (agt.indexOf("webtv") != -1); 
  864.  
  865.     var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
  866.     var is_AOLTV = is_TVNavigator;
  867.  
  868.     var is_hotjava = (agt.indexOf("hotjava") != -1);
  869.     var is_hotjava3 = (is_hotjava && (is_major == 3));
  870.     var is_hotjava3up = (is_hotjava && (is_major >= 3));
  871.  
  872.     // *** JAVASCRIPT VERSION CHECK ***
  873.     var is_js;
  874.     if (is_nav2 || is_ie3) is_js = 1.0;
  875.     else if (is_nav3) is_js = 1.1;
  876.     else if (is_opera5up) is_js = 1.3;
  877.     else if (is_opera) is_js = 1.1;
  878.     else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
  879.     else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
  880.     else if (is_hotjava3up) is_js = 1.4;
  881.     else if (is_nav6 || is_gecko) is_js = 1.5;
  882.     // NOTE: In the future, update this code when newer versions of JS
  883.     // are released. For now, we try to provide some upward compatibility
  884.     // so that future versions of Nav and IE will show they are at
  885.     // *least* JS 1.x capable. Always check for JS version compatibility
  886.     // with > or >=.
  887.     else if (is_nav6up) is_js = 1.5;
  888.     // NOTE: ie5up on mac is 1.4
  889.     else if (is_ie5up) is_js = 1.3
  890.  
  891.     // HACK: no idea for other browsers; always check for JS version with > or >=
  892.     else is_js = 0.0;
  893.  
  894.     // *** PLATFORM ***
  895.     var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
  896.     // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
  897.     //        Win32, so you can't distinguish between Win95 and WinNT.
  898.     var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
  899.  
  900.     // is this a 16 bit compiled version?
  901.     var is_win16 = ((agt.indexOf("win16")!=-1) || 
  902.                (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
  903.                (agt.indexOf("windows 16-bit")!=-1) );  
  904.  
  905.     var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
  906.                     (agt.indexOf("windows 16-bit")!=-1));
  907.  
  908.     var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
  909.     var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));
  910.  
  911.     // NOTE: Reliable detection of Win98 may not be possible. It appears that:
  912.     //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
  913.     //       - On Mercury client, the 32-bit version will return "Win98", but
  914.     //         the 16-bit version running on Win98 will still return "Win95".
  915.     var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
  916.     var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
  917.     var is_win32 = (is_win95 || is_winnt || is_win98 || 
  918.                     ((is_major >= 4) && (navigator.platform == "Win32")) ||
  919.                     (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
  920.  
  921.     var is_os2   = ((agt.indexOf("os/2")!=-1) || 
  922.                     (navigator.appVersion.indexOf("OS/2")!=-1) ||   
  923.                     (agt.indexOf("ibm-webexplorer")!=-1));
  924.  
  925.     var is_mac    = (agt.indexOf("mac")!=-1);
  926.     // hack ie5 js version for mac
  927.     if (is_mac && is_ie5up) is_js = 1.4;
  928.     var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
  929.                                (agt.indexOf("68000")!=-1)));
  930.     var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
  931.                                 (agt.indexOf("powerpc")!=-1)));
  932.  
  933.     var is_sun   = (agt.indexOf("sunos")!=-1);
  934.     var is_sun4  = (agt.indexOf("sunos 4")!=-1);
  935.     var is_sun5  = (agt.indexOf("sunos 5")!=-1);
  936.     var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
  937.     var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
  938.     var is_irix5 = (agt.indexOf("irix 5") !=-1);
  939.     var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
  940.     var is_hpux  = (agt.indexOf("hp-ux")!=-1);
  941.     var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
  942.     var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
  943.     var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
  944.     var is_aix1  = (agt.indexOf("aix 1") !=-1);    
  945.     var is_aix2  = (agt.indexOf("aix 2") !=-1);    
  946.     var is_aix3  = (agt.indexOf("aix 3") !=-1);    
  947.     var is_aix4  = (agt.indexOf("aix 4") !=-1);    
  948.     var is_linux = (agt.indexOf("inux")!=-1);
  949.     var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
  950.     var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
  951.     var is_mpras    = (agt.indexOf("ncr")!=-1); 
  952.     var is_reliant  = (agt.indexOf("reliantunix")!=-1);
  953.     var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
  954.            (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
  955.            (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
  956.     var is_sinix = (agt.indexOf("sinix")!=-1);
  957.     var is_freebsd = (agt.indexOf("freebsd")!=-1);
  958.     var is_bsd = (agt.indexOf("bsd")!=-1);
  959.     var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
  960.                  is_sco ||is_unixware || is_mpras || is_reliant || 
  961.                  is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
  962.  
  963.     var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
  964. // End: Ultimate client-side JavaScript client sniff. Version 3.02
  965.  
  966.  
  967. // ]]-->
  968.